from django.db import models
from user.models import User

class Complaint(models.Model):
    uid = models.IntegerField(default=0)
    rid = models.IntegerField(default=0)
    worker = models.IntegerField(null=True)
    info = models.TextField(null=True)
    starValue = models.IntegerField(null=True)

    def get_info(self):
        dic = dict()
        dic['cpid'] = self.id
        dic['uid'] = self.uid
        dic['rid'] = self.rid
        dic['worker'] = self.worker
        dic['info'] = self.info
        dic['starValue'] = self.starValue
        dic['username'] = User.objects.get(id=self.uid).username
        return dic
